<?php

/**
 * Created by PhpStorm.
 * User: jieai
 * Date: 2017-03-29
 * Time: 22:10
 * @param $item
 * @param int $pid
 * @return array
 */
function sortnode($item,$pid=0)
{
    $arr=array();
    foreach ($item as $vo) {
        if ($vo['pid']==$pid){
            $vo['child']=sortnode($item,$vo['id']);
            $arr[]=$vo;
        }
    }
    return $arr;

}
function P($item){
    dump($item,1,'<prt>',0);
}
?>